package com.zhangzhibo.filter;

import com.zhangzhibo.pojo.User;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class PageJumpInterceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        User userSession = (User)request.getSession().getAttribute("userSession");
        int role = userSession.getUserRole();
        if(role ==0 || role == 3){
//            if (request.getRequestURL()){
                System.out.println(request.getRequestURL());
        }
        return HandlerInterceptor.super.preHandle(request, response, handler);
    }
}
